package p1;

public class T12 {

    public static void main(String[] args) {
        Animal2 d=new Dog2(),c=new Cat2();
        d.eat(3);
        c.eat(2);
        d.eat(18);
        c.eat(5);
        System.out.println(Animal2.fish);
        System.out.println(Animal2.bone);
    }
}

abstract class Animal2{
    protected static int fish=0;
    protected static int bone=0;
    public abstract void eat(int n);
}
class Cat2 extends Animal2{
    @Override
    public void eat(int n) {
        System.out.println("高兴的吃小鱼");
        fish+=n;
    }
}
class Dog2 extends Animal2{

    @Override
    public void eat(int n) {
        System.out.println("欢乐的啃骨头");
        bone+=n;
    }
}